<template>
	<div class="newslifo">
		<h3 class="title">{{newsInfo.title }}</h3>
		<p class="subtitle">
			<span>发表时间：{{newsInfo.add_time | dateFormat}}</span>
			<span>点击：{{newsInfo.click}}次</span>
		</p>
		<hr>
		<div class="content" v-html="newsInfo.content">

		</div>
		<comment :id="this.id"></comment>
		
	</div>
</template>
<!--<link rel="stylesheet" href="../subcomment/new_file.css" />-->
<script>
	import  comment  from '../subcomment/comment.vue'
	import { Toast } from 'mint-ui'
	export default({
		data() {
			return {
				id: this.$route.params.id,
				newsInfo: []
			}
		},
		created() {
			this.getNewsInfo();

		},
		methods: {
			getNewsInfo() {
				var id = this.id
//				console.log(id)
				this.$http.get('api/getnew/'+id).then(function(data) {
//					console.log(data.body)
					if(data.body.status ==0) {
						
						this.newsInfo = data.body.message[0];
					

					} else {
						'获取新闻详细列表失败'}

				})
			}
		},
		components:{
			"comment":comment
		}
	})
</script>

<style lang="less">
	.newslifo {
		padding: 0 4px;
		.title {
			font-size: 14px;
			text-align: center;
			margin: 15px 0;
			color: red;
		}
		.subtitle {
			font-size: 13px;
			color: royalblue;
			display: flex;
			justify-content: space-between;
		}
		.content{
			width: 100%;
		}
	}
</style>